package com.shigen.demo.thread;

import cn.hutool.core.util.RandomUtil;

public class KuangThread01 implements Runnable{
    private int ticketsNums = 10;

    @Override
    public void run() {
        while (true) {
            if (ticketsNums <=0) {
                break;
            }
            // ticketsNums -= ticketsNums;
            System.out.println(Thread.currentThread().getName() + ticketsNums--);
            try {
                Thread.sleep(RandomUtil.randomInt(10000));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

    public static void main(String[] args) {
        KuangThread01 ticket = new KuangThread01();

        new Thread(ticket,"aa").start();
        new Thread(ticket,"bb").start();
        new Thread(ticket,"cc").start();
    }
}
